import java.util.HashSet;
import java.util.Scanner;

public class demo04 {
    //子串分值和
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int count=0;
        for (int i = 0; i < str.length(); i++) {
            for (int j = i; j < str.length(); j++) {
                HashSet<Character> set=new HashSet<>();
                for (int k = i; k <= j; k++) {
                    set.add(str.charAt(k));
                }
                count+=set.size();
            }
        }
        System.out.println(count);
    }
}
